#ifndef ELRADIO_H
#define ELRADIO_H

#include "../basic/elabstractbutton.h"

class ElRadio : public ElAbstractButton
{
    Q_OBJECT
public:
    ElRadio(QWidget *parent = nullptr);
    ElRadio(const QString &text, QWidget *parent = nullptr);

    bool checked() const;
    void setChecked(bool checked);

    bool hasBorder() const;
    void setBorder(bool b);

signals:
    void toggled(bool checked);

protected:
    bool event(QEvent *e) override;
    void paintEvent(QPaintEvent *e) override;
    void enterEvent(QEnterEvent *e) override;
    void leaveEvent(QEvent *e) override;
    void mousePressEvent(QMouseEvent *e) override;
    void mouseReleaseEvent(QMouseEvent *e) override;
    void initPalette() override;

    void drawBorder(QPainter *painter);
    void drawChecked(QPainter *painter);

    bool _checked = false;
    bool _border = false;
    QRectF _circle;

private:
    Q_PROPERTY(bool checked READ checked WRITE setChecked NOTIFY toggled FINAL)
};

#endif // ELRADIO_H
